<template>
  <a
    :class="[`c-link c-link--${props.type}`, { 'is-disabled': disabled }]"
    :href="href"
    @click="handleClick"
  >
    <slot></slot>
  </a>
</template>
<script lang="ts">
export default {
  name: 'CLink'
};
</script>
<script lang="ts" setup>
import { defineEmits, defineProps, withDefaults } from 'vue';

interface IProps {
  type?: 'default' | 'primary' | 'info'; // default对应蓝色，primary 绿色 info 灰色
  href?: string;
  disabled?: boolean;
}
const props = withDefaults(defineProps<IProps>(), {
  type: 'default',
  disabled: false
});
const emits = defineEmits(['click']);
const handleClick = () => {
  if (props.disabled) return;
  if (props.href) return;
  emits('click');
};
</script>
